package cas.ihep.hdfs;

import org.apache.hadoop.hdfs.protocol.BlockLocalPathInfo;
import org.apache.hadoop.hdfs.protocol.LocatedBlock;

import java.io.IOException;

/**
 * Created by gesturewei on 17-3-24.
 */
public class HdfsReadableBlock extends HdfsBlock {

    public HdfsReadableBlock(HdfsFile parent, LocatedBlock blockId)throws IOException {
        super(parent,blockId);
    }

    public String getBlockPath()throws IOException {
        if (!isLocal()){
            return null;
        }
        BlockLocalPathInfo info=mDatanodeClient.getBlockLocalPathInfo(mBlock.getBlock(),mBlock.getBlockToken());
        return info.getBlockPath();
    }

}
